﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SGS.Standard.EventArgs;
using SGS.Cards;
// using SGS.Rule;

namespace SGS.Standard.Actor.HumanAnswerActor
{
    public class UseCardActor : ActorBase // , INoticeMessage
    {
        public UseCardActor()
        {
            UsedCards = new List<Card>();
        }

        public override string ActocName
        {
            get { return "Use own card"; }
        }

        public List<Card> UsedCards
        {
            get;
            set;
        }

        private CardType _AsSkillType = CardType.Default;
        public virtual CardType AsSkillType
        {
            get
            {
                if (_AsSkillType == CardType.Default && UsedCards.Count == 0)
                {
                    return CardType.None;
                }
                else if (_AsSkillType == CardType.Default && UsedCards.Count > 0)
                {
                    return UsedCards[0].CardType;
                }
                else
                {
                    return _AsSkillType;
                }
            }
            set
            {
                _AsSkillType = value;
            }
        }

        public virtual List<Player> TargetFirst
        {
            get;
            set;
        }

        public virtual List<Player> TargetSecond
        {
            get;
            set;
        }        

        public virtual bool CardUseRuleCheck()
        {
            return UsedCards.Count == 1;
        }

        public override bool CheckHumanActor( HumanActorEventArgs e )
        {
            if (UsedCards != null && UsedCards.Count > 0 && e.AnswerPlayer.GameInfo.HasCard( UsedCards.ToArray() ))
            {
                return true;
            }
            return false;
        }
    }
}
